<template>
	<view class="payment-success-overlay">
		<view class="payment-success-container">
			<view class="payment-header">
				<view class="payment-back-btn" @click="goBack">
					<image class="payment-back-icon" src="/static/left-icon.png" mode="aspectFit"></image>
				</view>
				<view class="payment-title-section">
					<text class="payment-title">Payment Result</text>
				</view>
				<view class="payment-header-placeholder"></view>
			</view>
			<view class="payment-main-image-section">
				<image class="payment-main-image" :src="form&&form.tin_status==1 ? '/static/Payment_img01.png' : '/static/Payment_fail.png'" mode="aspectFit"></image>
			</view>
			<view class="payment-success-text-section">
				<image class="payment-success-bg" src="/static/Payment_img02.png" mode="aspectFit"></image>
				<text class="payment-success-text">{{ form&&form.tin_status==1 ?  'Payment Successful！' : 'Payment Failed！' }}</text>
			</view>
			<view class="payment-info-section">
				<view class="payment-info-bg-wrapper">
					<view class="payment-info-content">
						<view v-if="isSuccess" class="payment-info-item">
							<text class="payment-info-label">Payment Amount：</text>
							<text class="payment-info-value">${{ form.int_pay_amount }}</text>
						</view>
						<view v-if="isSuccess" class="payment-info-item">
							<text class="payment-info-label">Payment Time：</text>
							<text class="payment-info-value">{{ form.gmt_time }}</text>
						</view>
						<view class="payment-info-item">
							<text class="payment-info-label">Order Number：</text>
							<text class="payment-info-value">{{ form.cha_recharge_order_sn }}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="payment-return-btn-section">
				<view class="payment-return-btn" @click="goBack">
					<!-- <image class="payment-return-btn-bg" src="/static/Payment_img03.png" mode="aspectFit"></image> -->
					<text class="payment-return-btn-text">Return</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				paymentInfo: {
					amount: '0.00',
					time: '$52.36',
					orderNumber: '53555635314563416341563416355'
				},
				// 是否支付成功失败切换
				isSuccess: true,
				form:null,
			}
		},
		onLoad(option) {
			if(options?.cha_recharge_order_sn){
				this.token = options?.token
				this.cha_recharge_order_sn = options?.cha_recharge_order_sn
				this.getOrderInfo()
			}
		},
		methods: {
			goBack() {
				// uni.navigateBack({
				// 	delta: 1
				// });
				//返回app的页面不是固定的，好像下面这个接口 orderInfo会返回来，现在只是一个例子
				location.href = "lustory://pages/content/content?vid=52025739476"
			},
			getOrderInfo(){
				const {cha_recharge_order_sn,token} = this
				this.$api.orderInfo({ chaRechargeOrderSn:cha_recharge_order_sn,token}).then(res=>{
					const { code,data } = res
					if(code == 0){
						this.form = data
					}
				})
			},
		}
	}
</script>

<style scoped>
	/* 支付成功弹窗样式 */
	.payment-success-overlay {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: #1F1F1F;
		z-index: 10000;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.payment-success-container {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		position: relative;
		padding: 40rpx;
		box-sizing: border-box;
	}

	/* 顶部导航栏 */
	.payment-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		position: relative;
		margin-bottom: 60rpx;
	}

	.payment-back-btn {
		width: 60rpx;
		height: 60rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		cursor: pointer;
	}

	.payment-back-icon {
		width: 24rpx;
		height: 24rpx;
	}

	.payment-title-section {
		flex: 1;
		text-align: center;
		margin: 0;
	}

	.payment-header-placeholder {
		width: 60rpx;
		height: 60rpx;
	}

	.payment-title {
		color: #FFFFFF;
		font-size: 28rpx;
		font-weight: bold;
	}

	.payment-main-image-section {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-bottom: 40rpx;
	}

	.payment-main-image {
		width: 400rpx;
		height: 300rpx;
	}

	.payment-success-text-section {
		position: relative;
		text-align: center;
		margin-bottom: 20rpx;
		margin-top: 20rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.payment-success-bg {
		position: absolute;
		width: 100%;
		z-index: 1;
	}

	.payment-success-text {
		position: relative;
		z-index: 2;
		color: #FFFFFF;
		font-size: 42rpx;
		font-weight: bold;
	}

	.payment-info-section {
		margin: 36rpx 0rpx 30rpx 0rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.payment-info-bg-wrapper {
		background: rgba(0, 0, 0, 0.8);
		border-radius: 20rpx;
		padding: 40rpx 30rpx;
		width: 100%;
		box-sizing: border-box;
		backdrop-filter: blur(10rpx);
		border: 1rpx solid rgba(255, 255, 255, 0.1);
	}

	.payment-info-content {
		width: 100%;
	}

	.payment-info-item {
		display: flex;
		align-items: center;
		margin-bottom: 30rpx;
	}

	.payment-info-item:last-child {
		margin-bottom: 0;
	}

	.payment-info-label {
		color: #FFFFFF;
		font-size: 24rpx;
	}

	.payment-info-value {
		color: #FFFFFF;
		font-size: 24rpx;
	}

	.payment-return-btn-section {
		display: flex;
		justify-content: center;
		align-items: center;
		padding-bottom: 60rpx;
	}

	.payment-return-btn {
		position: relative;
		display: flex;
		justify-content: center;
		align-items: center;
		width: 98%;
		height: 80rpx;
		background: linear-gradient(to bottom,#F3655C,#EE3038);
		border-radius: 80rpx;
	}

	.payment-return-btn-bg {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		z-index: 1;
	}

	.payment-return-btn-text {
		margin: 13rpx 0;
		position: relative;
		z-index: 2;
		color: #FFFFFF;
		font-size: 36rpx;
		font-weight: bold;
	}
</style>